<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>

        // 宏任务
        setTimeout(() => {
            console.log("宏任务");
        }, 0);

        // 同步执行
        let p  = new Promise((resolve,reject)=>{
            console.log("执行器函数");
            resolve('ok');
        });;

        // 微任务
        p.then(val=>{
            console.log("微任务",val);
        });

        // 同步代码
        console.log('end，同步任务');


    </script>
</body>
</html>